﻿Public Class Alumnos
    Inherits Negocio
    Dim ocdAlumnos As New CapaDatos.Alumnos

    Private _dniAlumno As String
    Public Property dniAlumno() As String
        Get
            Return _dniAlumno
        End Get
        Set(ByVal value As String)
            _dniAlumno = value
        End Set
    End Property


    Private _nombre As String
    Public Property nombre() As String
        Get
            Return _nombre
        End Get
        Set(ByVal value As String)
            _nombre = value
        End Set
    End Property


    Private _fechaNac As String
    Public Property fechaNac() As String
        Get
            Return _fechaNac
        End Get
        Set(ByVal value As String)
            _fechaNac = value
        End Set
    End Property


    Private _email As String
    Public Property email() As String
        Get
            Return _email
        End Get
        Set(ByVal value As String)
            _email = value
        End Set
    End Property


    Private _domicilio As String
    Public Property domicilio() As String
        Get
            Return _domicilio
        End Get
        Set(ByVal value As String)
            _domicilio = value
        End Set
    End Property


    Private _estadoCivil As String
    Public Property estadoCivil() As String
        Get
            Return _estadoCivil
        End Get
        Set(ByVal value As String)
            _estadoCivil = value
        End Set
    End Property


    Public Function alumnoValido() As Boolean

        If Me.dniAlumno = "" Then
            Return False
        ElseIf Me.nombre = "" Then
            Return False
        ElseIf Me.domicilio = "" Then
            Return False
        ElseIf Me.fechaNac = "" Then
            Return False
        ElseIf Me.estadoCivil = "" Then
            Return False
        ElseIf Me.email = "" Then
            Return False
        Else
            Return True
        End If
    End Function

    Public Sub rellenarAtributos()
        ocdAlumnos.dniAlumno = Me.dniAlumno
        ocdAlumnos.nombre = Me.nombre
        ocdAlumnos.domicilio = Me.domicilio
        If fechaNac <> "" Then
            ocdAlumnos.fechaNac = CDate(Me.fechaNac)
        Else
            ocdAlumnos.fechaNac = Me.fechaNac
        End If
        ocdAlumnos.estadoCivil = Me.estadoCivil
        ocdAlumnos.email = Me.email
    End Sub

    Public Function insertarAlumno() As Boolean
        Me.rellenarAtributos()
        'If alumnoValido() Then
        ocdAlumnos.insertarAlumno()
        Return True
        'Else
        'Return False
        'End If
    End Function

    Public Sub InsertarAlumno(ByVal dniAlumno As String _
             , ByVal Nombre As String, ByVal FechaNac As DateTime _
             , ByVal email As String _
             , ByVal domicilio As String _
             , ByVal estadoCivil As String)
        ocdAlumnos.InsertarAlumno(dniAlumno, Nombre _
                                           , FechaNac, email _
                                           , domicilio, estadoCivil)

    End Sub


    Public Sub InsertarInfoLaboral(ByVal dniAlumno As String _
           , ByVal nombreEmpresa As String, ByVal puesto As String _
           , ByVal funciones As String _
           , ByVal antiguedad As String)
        ocdAlumnos.InsertarInfoLaboral(dniAlumno, nombreEmpresa _
                                   , puesto, funciones _
                                   , antiguedad)
    End Sub


    Public Sub InsertarInfoAcademica(ByVal dniAlumno As String _
                    , ByVal NombreInstitucion As String, ByVal tituloPosgrado As String _
                    , ByVal añoObtencion As String)
        ocdAlumnos.InsertarInfoAcademica(dniAlumno, NombreInstitucion _
                                           , tituloPosgrado, añoObtencion)
    End Sub


    Public Function obtenerAlumno() As DataSet
        Return ocdAlumnos.obtenerAlumno()
    End Function


    Public Function obtenerVistaAlumnoInfoAcademica() As DataSet
        Return ocdAlumnos.ObtenerVistaInfoAcademica()
    End Function

    Public Function obtenerVistaAlumnoInfoAcademica(ByVal dni As String) As DataSet
        Return ocdAlumnos.ObtenerVistaInfoAcademica(dni)
    End Function


    Public Function obtenerVistaAlumnoInfoLaboral(ByVal dni As String) As DataSet
        Return ocdAlumnos.ObtenerVistaInfoLaboral(dni)
    End Function



    Public Function obtenerVistaAlumnoInfoLaboral() As DataSet
        Return ocdAlumnos.ObtenerVistaInfoLaboral()
    End Function

End Class
